<?php
namespace app\admin\api;

use think\Controller;
use \think\Session;
use app\admin\common\Http\ConferenceHttpClient;

//站点会员接口类
class ConferenceMember extends ConferenceHttpClient
{

    /**
     * 获取会议站站点会员列表
     * @return [type] [description]
     */
    public function memberList($token,$data)
    {
        //获取数据
        $url = '/v1/site/members';

        $res['page'] = $data['page'];
        $res['page_size'] = $data['limit'];

        //设置headers头
        $headers = getheader($token);

        //请求接口信息
        $result = $this->get($url,$res,$headers);

        if ($result->code == 0){
            return $result->data;

        }else{
            return $result->message;
        }
    }

    /**
     * 获取会员信息详情
     * @return [type] [description]
     */
    public function memberDetails($id,$token)
    {
        //获取数据
        $url = '/v1/site/members/'.$id;

        //设置headers头
        $headers = getheader($token);

        $res = array();
        //$res['id'] = $id;
        //请求接口信息
        $result = $this->get($url,$res,$headers);

        if ($result->code == 0){
            return $result->data->item;
        }else{
            return $result->message;
        }

    }

    /**
     * 会议站会员删除
     * @return [type] [description]
     */
    public function memberDelete($id,$token)
    {
        //获取数据
        $url = '/v1/site/members/'.$id;

        //设置headers头
        $headers = getheader($token);

        $res = array();
        //$res['id'] = $id;
        //请求接口信息
        $result = $this->delete($url,$res,$headers);

        if ($result->code == 0){
            return 555;
        }else{
            return $result->message;
        }
    }

}